<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<title>判断非空的用法</title>
</head>

<body>

	<p>判断非空的用法</p>
	<p id="demo"></p>
	<script>
		let user = {
			name: "xq",
			like : function(){
				console.log("like")
			},
			address : {
			  province: "安徽",
			  city: "合肥"
			}
		}
		console.log("名字=%s",user.name)
		console.log("地址1=%s", user.address?.city || '')
		console.log("地址2=%s",user.address.city || '')
		console.log("地址3=%s",user.address?.mok || '12')
	</script>

</body>

</html>